package com.bootssm.service.impl;

import com.bootssm.dao.ShopListMapper;
import com.bootssm.entity.ShopList;
import com.bootssm.entity.ShopListVO;
import com.bootssm.service.ShopListService;
import com.bootssm.utils.IdWorker;
import com.bootssm.utils.TimeUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class ShopListServiceImpl implements ShopListService {

    @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
    @Autowired
    ShopListMapper shopListMapper;
    @Autowired
    IdWorker idWorker;
    @Override
    public List<ShopList> findAll(ShopListVO shopListVO) {
        return shopListMapper.findAll(shopListVO);
    }

    @Override
    public Integer getCount(ShopListVO shopListVO) {
        return shopListMapper.getCount(shopListVO);
    }

    @Override
    public void deleteById(String id) {
        shopListMapper.deleteById(id);
    }

    @Override
    public void update(ShopList shopList) {
        shopListMapper.update(shopList);
    }

    @Override
    public void save(ShopList shopList) {
        String l = String.valueOf(idWorker.nextId());
        shopList.setShopid(l);
        shopList.setCreatedate(TimeUtil.getCurrentTime(new Date()));
        shopListMapper.save(shopList);
    }
}
